package likou.jindian;

/**
 * @author: Tangxz
 * @email: 1171702529@qq.com
 * @cate: 2021/01/28 10:11
 */
public class _10_10 {
    int[] nums;
    int size = 16;
    int index = 0;
    public _10_10() {
        nums = new int[size];
    }

    public void track(int x) {
        if(index==size){
            size = size*2;
            int[] newNums = new int[size];
            System.arraycopy(nums, 0,newNums, 0,nums.length);
            nums = newNums;
        }
        nums[index++] = x;
    }

    public int getRankOfNumber(int x) {
        int n = 0;
        for (int i:nums){
            if (i<=x){
                n++;
            }
        }
        return n;
    }
}
